package com.zcxx.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDate;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "Employee", description = "员工实体类") // 描述实体类
public class Employee {
    @TableId(type = IdType.AUTO) // 使用数据库自增主键
    @ApiModelProperty(value = "员工ID", example = "1") // 描述字段
    private Integer id;

    @ApiModelProperty(value = "员工姓名", example = "张三") // 描述字段
    private String name;

    @ApiModelProperty(value = "员工薪资", example = "10000.00") // 描述字段
    private BigDecimal salary;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "员工生日", example = "1990-01-01") // 描述字段
    private LocalDate birthday;

    //-- 修改表的字符集和排序规则
    //    ALTER TABLE employee CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    //-- 修改列的字符集和排序规则
    //    ALTER TABLE employee MODIFY photo VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    //如果数据库不能插入就用上面的两个命令
    @ApiModelProperty(value = "员工照片路径", example = "/images/photo.jpg") // 描述字段
    private String photo; // 存储照片路径
}